<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>子向父传递数值</title>
  </head>
  <body>
    <div class="box">
      <son @fa="getFahter($event)"></son>
    </div>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script>
      Vue.component('son', {
        data: function () {
          return {}
        },
        template: `
        <div>
        <button @click="$emit('fa',10)">单son击</button>
        </div>
        `,
      })

      new Vue({
        el: '.box',
        data: {},
        methods: {
          getFahter(val) {
            console.log('拿到father的数据' + val)
          },
        },
      })
    </script>
  </body>
</html>
